﻿$(() => {
    const $container = $('body > .container');
    // 图像评估
    $container.on('imageAssessment', (e, data) => {
        getOids(data).then(oids => {
            if (oids.length === 0) {
                DevExpress.ui.notify('请选择要操作的数据', 'error');
            } else {
                //工作流
                $.invokeAction('图像评估', `/api/report/image-assessment/${oids[0]}`, null, { type: 'GET', actionUrl: '/api/workflow/invoke' }).then(result => {
                    if (result.success) {
                        DevExpress.ui.notify('图像评估', 'success');
                        refreshDataGrid(data);
                    }
                });
            }
        });
    });
    // 报告评分
    $container.on('score', (e, data) => {
        getOids(data).then(oids => {
            if (oids.length === 0) {
                DevExpress.ui.notify('请选择要操作的数据', 'error');
            } else {
                //工作流
                $.invokeAction('报告评分', `/api/report/score/${oids[0]}`, null, { type: 'GET', actionUrl: '/api/workflow/invoke' }).then(result => {
                    if (result.success) {
                        DevExpress.ui.notify('报告评分', 'success');
                        refreshDataGrid(data);
                    }
                });
            }
        });
    });
})